import { R_tableData, R_add, R_update, R_remove } from "@/utils/tableData";



import request from '@/utils/request'

export const A_tableData = function(data) {
    return R_tableData({
        method: 'post',
        url: '/SciPro/list',
        data,
    })
}


export const A_add = function(data) {
    return R_add({
        method: 'post',
        url: '/SciPro/add',
        data
    })
}


export const A_update = function(data) {
    return R_update({
        method: 'post',
        url: '/SciPro/update',
        data
    })
}

export const A_remove = function(ID) {
    return R_remove({
        method: 'post',
        url: '/SciPro/delete',
        data: {
            proKey: ID
        }
    })
}


export const A_check_T = async function(data) {
    let result = await request({
        method: 'post',
        url: '/SciPro/Tshen',
        data,
    })
    return result
}


export const A_check_F = async function(data) {
    let result = await request({
        method: 'post',
        url: '/SciPro/Nshen',
        data,
    })
    return result
}

/**
 * 下载表格
 * @param {*} data 
 * @returns 
 */
export const A_downLoadExcel = async function() {
    let res = await request({
        method: 'post',
        url: '/SciPro/downloadExcel',
        headers: {
            "Content-Type": 'application/octet-stream;charset=UTF-8'
        },
        responseType: 'blob'
    })
    return res
}

/**
 * 获取个人附件
 * @param {*} proKey 唯一标识
 */
export const A_getFile = async function(proKey) {
    let res = await request({
        method: 'post',
        url: '/SciPro/Perfile',
        data: {
            proKey
        }
    })
    return res
}

/**
 * 获取一级等级
 * @returns 
 */
export const A_getLevel1 = async function() {
    let res = await request({
        method: 'get',
        url: '/SciPro/Level'
    })
    return res
}




/**
 * 
 * @param {*} proCategory 一级等级
 * @returns 
 */
export const A_getLevel2 = async function(proCategory) {
    let res = await request({
        method: 'post',
        url: '/SciPro/getLevel',
        data: {
            proCategory
        }
    })
    return res
}

/**
 * 
 * @param {*} proLevel 二级等级
 * @returns 
 */
export const A_getLevel3 = async function(proCategory,proLevel) {
    let res = await request({
        method: 'post',
        url: '/SciPro/geCount',
        data: {
            proCategory,proLevel
        }
    })
    return res
}


/**
 * 
 * @param {*} proCount 三级等级
 * @returns 
 */
export const A_getLevel4 = async function(proCategory,proLevel,proCount) {
    let res = await request({
        method: 'post',
        url: '/SciPro/geRanking',
        data: {
            proCategory,proLevel,proCount
        }
    })
    return res
}

export const A_downLoadExample = async function() {
    let res = await request({
        method: 'get',
        url: '/SciPro/downloadExcelExample',
        headers: {
            "Content-Type": 'application/octet-stream;charset=UTF-8'
        },
        responseType: 'blob'
    })
    return res
}